<script setup>
import{ getCinemaDeatilByid } from '../api/home';
import { onMounted, reactive } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const props = defineProps({
  list: Array
  
});
const tocinemadetail= (id)=>{
    router.push('/cinemadetail?cinemaId='+id)
}

</script>
<template>
  <div class="Cinema">
      <div class="cinema-item" v-for="item in props.list" :key="item.id" @click="tocinemadetail(item.cinemaId)">
      <span class="title">{{ item.title }}</span>
      <span class="price">{{ item.price.n }} {{ item.price.q }}</span>
      <div class="loc">
        <p class="location">{{ item.location }}</p>
        <p class="distance">{{ item.distance }}</p>
      </div>
      <div class="services">
        <span
          v-for="service in item.services"
          :key="service.index"
          :class="service.code"
        >
          {{ service.text }}
        </span>
      </div>
      <div class="card" v-for="discount in item.discount" :key="discount.index">
        <img :src="discount.card" width="12px" height="12px" />
        <span class="text">{{ discount.text }}</span>
      </div>
    </div>
  </div>
  <div class="kong"></div>
</template>
<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
  list-style: none;
}
.Cinema {
  scroll-behavior: auto;
  // display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    text-overflow: ellipsis;
    overflow-x: hidden;
  .cinema-item {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid grey;
    margin-left: 20px;
    padding: 16px 13px 12px 0;
    line-height: 10px;
    
    .title {
      line-height: 20px;
      font-size: 16px;
      margin-right: 5px;
      color: black;
    }
    .price {
      color: red;
      font-size: 14px;
    }
    .loc {
      width: 100%;
      display: flex;
      .location {
        color: grey;
        font-size: 12px;
        margin: 5px 0;
        width: 80%;
      }
      .distance {
        margin: 5px 0 0 5px;
        font-size: 12px;
        color: grey;
        text-align: center;
      }
    }

    .services {
      display: flex;
      .snack,
      .vipTag {
        font-size: 8px;
        margin: 0 5px 5px 0;
        color: #f90;
        border: 0.02rem solid #f90;
      }
      .allowRefund,
      .endorse {
        font-size: 8px;
        margin: 0 5px 5px 0;
        color: #589daf;
        border: 0.02rem solid #589daf;
      }
      .hallType {
        font-size: 8px;
        margin: 0 5px 5px 0;
        color: #589daf;
        border: 0.02rem solid #589daf;
      }
    }
    .card {
      .text {
        font-size: 10px;
        color: grey;
        text-align: center;
      }
    }
  }
}
.kong {
  height: 45px;
}
</style> 
